package com.hotvoice.android;


import java.io.File;
import java.util.Date;

import android.app.Activity;
import android.os.Bundle;

import com.hotvoice.android.utils.AMRUtil;

public class HotvoiceActivity extends Activity {
	  public Date m_last_ended_time;
	  public Date m_last_started_time;
	  public String m_linenumber;
	  public static String file_format;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
    
    
    public void updateDB()
    {
      //NativeTask.stop();
      this.app.releaseWakeLock();
      Date localDate1 = this.m_last_ended_time;
      Date localDate2 = this.m_last_started_time;
      String str1 = this.m_linenumber;
      String str2 = NativeTask.file_path;
      File[] arrayOfFile = new File(str2).listFiles();
      long l1 = 0L;
      String str3 = null;
      String str4 = null;
      Object localObject1 = null;
      int i = arrayOfFile.length;
      if (localObject1 >= i)
        return;
      if ((!arrayOfFile[localObject1].isFile()) || (!arrayOfFile[localObject1].getName().contains(".pcm")) || (arrayOfFile[localObject1].getName().equals("voice.pcm")));
      Object localObject2;
      do
      {
        long l3;
        do
        {
          localObject1++;
          break;
          long l2 = arrayOfFile[localObject1].lastModified();
          l3 = localDate1.getTime() + 3000L;
        }
        while (l1 > l3);
        long l4 = localDate2.getTime();
      }
      while (l1 < localObject2);
      str3 = arrayOfFile[localObject1].getName();
      if (file_format.equals(".amr"))
      {
        str4 = arrayOfFile[localObject1].getName().replace(".pcm", ".amr");
        String str5 = String.valueOf(NativeTask.file_path);
        String str6 = str5 + "/" + str3;
        String str7 = String.valueOf(NativeTask.file_path);
        String str8 = str7 + "/" + str4;
        AMRUtil.EncodeAMRFile(str6, str8);
      }
      while (true)
      {
        arrayOfFile[localObject1].delete();
       // updateContent(str4, str1, localDate2, localDate1);
        break;
        str4 = arrayOfFile[localObject1].getName().replace(".pcm", ".wav");
        String str9 = String.valueOf(NativeTask.file_path);
        String str10 = str9 + "/" + str3;
        String str11 = String.valueOf(NativeTask.file_path);
        String str12 = str11 + "/" + str4;
        AMRUtil.PCM2Wave(str10, str12);
      }
    }

}